<#include "/common/common.ftl" encoding="UTF-8">
	<link href="${staticUrl}/js/validate/jquery.validate.css" type="text/css" rel="stylesheet" />
	<script src="${staticUrl}/js/validate/jquery.validate.js" type="text/javascript"></script>
	<script src="${staticUrl}/js/validate/messages_cn.js" type="text/javascript"></script>
	<link href="${staticUrl}/css/form.css" type="text/css" rel="stylesheet" />
	<#assign action="menu-resource">
	<script>
		var treeUrl = "${request.contextPath}/security/menu-resource!getResourceTree.action";
		$(document).ready(function(){
			//聚焦第一个输入框
			$("#name").focus();
			//为inputForm注册validate函数
			$("#inputForm").validate();
			$("#parentName").click(function(e){
				previewShow(e);
			});
		});
		function showDetail(id,title){
			$("#parentId").val(id);
			$("#parentName").val(title);
			$("#preview").hide();
		}
	</script>
</head>
<body>
<#include "/common/tree_div.ftl" encoding="UTF-8">
<div class="title"><#if id?exists>修改<#else>创建</#if>资源</div>
<div id="inputContent">
<form id="inputForm" action="${action}!save.action" method="post">
<input type="hidden" name="id" value="${(id)?if_exists}" />
<table class="content">
	<tr>
		<@ftlMacro.inputText name="name" descript="资源名" textShow="${name?if_exists}" cssStyle="required"/>
	</tr>
	<tr>
		<td class="textLabel">父资源:</td>
		<input type='hidden' name='parent.id' id="parentId" value="${(parent.id)?if_exists}" />
		<td class="textShow"><input type="text" name="parent.name" class='divshow' id="parentName" value="${(parent.name)?if_exists}" class="required" readonly='true'/></td>
	</tr>
	
	<tr>
		<@ftlMacro.inputText name="value" descript="资源标志" textShow="${value?if_exists}" cssStyle="required"/>
	</tr>
	<tr>
		<@ftlMacro.inputText name="orderNum" descript="顺序" textShow="${orderNum?if_exists}" cssStyle="required number"/>
	</tr>
	<tr>
		<td class="textLabel">资源类型:</td>
		<td>
		  	<#assign textValue={"menu":"菜单","url","资源"}>
		  	<#if !resourceType?exists>
		  	<#assign resourceType = "menu">
		  	</#if>
		  	<@ftlMacro.radio name="resourceType" textValues=textValue  checkedValue=resourceType />
		</td>
	</tr>
	<tr class="button">
		<td colspan="2">
			<input type="submit" value="提交" />&nbsp; 
			<input type="button" value="取消" onclick="history.back()"/>
		</td>
	</tr>
	<tr>
		<td colspan="2">
		</td>
	</tr>
</table>
</form>
</div>
</body>
</html>